package top.pcat.util;

import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

@Slf4j
public class RotationLoadBalancer {

    private int index;

    private final AtomicInteger atomicInteger = new AtomicInteger(0);

    public String getAddress(List<String> address) {
        if (address.size()==0){
            return "无服务器可用";
        }
        String value = address.get(atomicInteger.incrementAndGet() % address.size());
        System.out.println("value:" + value);
        return value;
    }



}

